#include<iostream>
#include<thread>
#include<future>
using namespace std;

mutex g_mutex;
int count=0;

void increment()
{
    for(int i=0;i<10000;i++)
    {
        lock_guard<mutex>lg(g_mutex);
        //线程持有锁
        count++;
        
    }
}
int main()
{
    thread t1(increment);
    thread t2(increment);

    t1.join();
    t2.join();

    cout<<"value:"<<count<<endl;
    

}